package tree;

import offer.TreeNode;

public class leetCode101_isSymmetric {
    public boolean isSymmetric(TreeNode root) {
        if(root == null) return false;
        return build(root.left,root.right);
    }

    public boolean build(TreeNode left,TreeNode right){
        if(left == null && right == null){
            return true;
        }
        if(left == null || right == null){
            return false;
        }

        return left.val == right.val && build(left.left,right.right) && build(left.right,right.left);
    }
}
